package LeetCode;

import java.util.Arrays;

public class LC_455_AssignCookies {

    public static void main(String[] args) {

    }

    class Solution {
        public int findContentChildren(int[] g, int[] s) {
            int ret = 0;
            Arrays.sort(g);
            Arrays.sort(s);
            int i = 0, j = 0;
            while (i < g.length && j < s.length) {
                if (g[i] <= s[j]) {
                    ret++;
                    i++;
                    j++;
                } else if (g[i] > s[j]) {
                    j++;
                }
            }
            return ret;
        }

    }
}